/* This code is restricted under LGPL license */
using System.Collections;
using System.Collections.Generic;
using NHibernate.Criterion;

namespace infoMECHANICA.NHibernateORM.CriteriaBuilder
{
    /// <summary>
    /// Internal criterion property (property which helps to define right (secondary) criterion
    /// </summary>
    /// <typeparam name="T">Base property type</typeparam>
    public class CriterionPropertyInternal<T> : CriterionPropertyBase<T>, ICriterionPropertyInternal<T>
    {
        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetBetween(T beginValue, T endValue)
        {
            this.SavedCriterion = Restrictions.Between(this.PropertyName, beginValue, endValue);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetEq(T value)
        {
            this.SavedCriterion = Restrictions.Eq(this.PropertyName, value);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetNotEq(T value)
        {
            this.SavedCriterion = Restrictions.Not(Restrictions.Eq(this.PropertyName, value));
        }


        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetGe(T value)
        {
            this.SavedCriterion = Restrictions.Ge(this.PropertyName, value);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetGt(T value)
        {
            this.SavedCriterion = Restrictions.Gt(this.PropertyName, value);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetLt(T value)
        {
            this.SavedCriterion = Restrictions.Lt(this.PropertyName, value);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetLe(T value)
        {
            this.SavedCriterion = Restrictions.Le(this.PropertyName, value);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetIsEmpty()
        {
            this.SavedCriterion = Restrictions.IsEmpty(this.PropertyName);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetIsNotEmpty()
        {
            this.SavedCriterion = Restrictions.IsNotEmpty(this.PropertyName);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetIsNull()
        {
            this.SavedCriterion = Restrictions.IsEmpty(this.PropertyName);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetIsNotNull()
        {
            this.SavedCriterion = Restrictions.IsNotNull(this.PropertyName);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetInsentiveLike(T value)
        {
            this.SavedCriterion = Restrictions.Like(this.PropertyName, value);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetLike(T value)
        {
            this.SavedCriterion = Restrictions.Like(this.PropertyName, value);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetIn(ICollection<T> values)
        {
            this.SavedCriterion = Restrictions.In(this.PropertyName, (ICollection)values);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetNotIn(ICollection<T> values)
        {
            this.SavedCriterion = Restrictions.Not(Restrictions.In(this.PropertyName, (ICollection)values));
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetEq(GenericSubqueryProjection<T> subqueryProjection)
        {
            this.SavedCriterion = Subqueries.PropertyEq(this.PropertyName, subqueryProjection.ProjectedCriteria);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetEqAll(GenericSubqueryProjection<T> subqueryProjection)
        {
            this.SavedCriterion = Subqueries.PropertyEqAll(this.PropertyName, subqueryProjection.ProjectedCriteria);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetGe(GenericSubqueryProjection<T> subqueryProjection)
        {
            this.SavedCriterion = Subqueries.PropertyGe(this.PropertyName, subqueryProjection.ProjectedCriteria);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetGeAll(GenericSubqueryProjection<T> subqueryProjection)
        {
            this.SavedCriterion = Subqueries.PropertyGeAll(this.PropertyName, subqueryProjection.ProjectedCriteria);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetGeSome(GenericSubqueryProjection<T> subqueryProjection)
        {
            this.SavedCriterion = Subqueries.PropertyGeSome(this.PropertyName, subqueryProjection.ProjectedCriteria);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetGt(GenericSubqueryProjection<T> subqueryProjection)
        {
            this.SavedCriterion = Subqueries.PropertyGt(this.PropertyName, subqueryProjection.ProjectedCriteria);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetGtAll(GenericSubqueryProjection<T> subqueryProjection)
        {
            this.SavedCriterion = Subqueries.PropertyGtAll(this.PropertyName, subqueryProjection.ProjectedCriteria);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetGtSome(GenericSubqueryProjection<T> subqueryProjection)
        {
            this.SavedCriterion = Subqueries.PropertyGtSome(this.PropertyName, subqueryProjection.ProjectedCriteria);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetIn(GenericSubqueryProjection<T> subqueryProjection)
        {
            this.SavedCriterion = Subqueries.PropertyIn(this.PropertyName, subqueryProjection.ProjectedCriteria);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetLe(GenericSubqueryProjection<T> subqueryProjection)
        {
            this.SavedCriterion = Subqueries.PropertyLe(this.PropertyName, subqueryProjection.ProjectedCriteria);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetLeAll(GenericSubqueryProjection<T> subqueryProjection)
        {
            this.SavedCriterion = Subqueries.PropertyLeAll(this.PropertyName, subqueryProjection.ProjectedCriteria);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetLeSome(GenericSubqueryProjection<T> subqueryProjection)
        {
            this.SavedCriterion = Subqueries.PropertyLeSome(this.PropertyName, subqueryProjection.ProjectedCriteria);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetLt(GenericSubqueryProjection<T> subqueryProjection)
        {
            this.SavedCriterion = Subqueries.PropertyLt(this.PropertyName, subqueryProjection.ProjectedCriteria);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetLtAll(GenericSubqueryProjection<T> subqueryProjection)
        {
            this.SavedCriterion = Subqueries.PropertyLtAll(this.PropertyName, subqueryProjection.ProjectedCriteria);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetLtSome(GenericSubqueryProjection<T> subqueryProjection)
        {
            this.SavedCriterion = Subqueries.PropertyLtSome(this.PropertyName, subqueryProjection.ProjectedCriteria);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetNe(GenericSubqueryProjection<T> subqueryProjection)
        {
            this.SavedCriterion = Subqueries.PropertyNe(this.PropertyName, subqueryProjection.ProjectedCriteria);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetNotIn(GenericSubqueryProjection<T> subqueryProjection)
        {
            this.SavedCriterion = Subqueries.PropertyNotIn(this.PropertyName, subqueryProjection.ProjectedCriteria);
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetEq(GenericSubqueryProjection<object> subqueryProjection)
        {
            SetEq(subqueryProjection.ToObjectSubqueryProjection());
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetEqAll(GenericSubqueryProjection<object> subqueryProjection)
        {
            SetEqAll(subqueryProjection.ToObjectSubqueryProjection());
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetGe(GenericSubqueryProjection<object> subqueryProjection)
        {
            SetGe(subqueryProjection.ToObjectSubqueryProjection());
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetGeAll(GenericSubqueryProjection<object> subqueryProjection)
        {
            SetGeAll(subqueryProjection.ToObjectSubqueryProjection());
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetGeSome(GenericSubqueryProjection<object> subqueryProjection)
        {
            SetGeSome(subqueryProjection.ToObjectSubqueryProjection());
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetGt(GenericSubqueryProjection<object> subqueryProjection)
        {
            SetGt(subqueryProjection.ToObjectSubqueryProjection());
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetGtAll(GenericSubqueryProjection<object> subqueryProjection)
        {
            SetGtAll(subqueryProjection.ToObjectSubqueryProjection());
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetGtSome(GenericSubqueryProjection<object> subqueryProjection)
        {
            SetGtSome(subqueryProjection.ToObjectSubqueryProjection());
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetIn(GenericSubqueryProjection<object> subqueryProjection)
        {
            SetIn(subqueryProjection.ToObjectSubqueryProjection());
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetLe(GenericSubqueryProjection<object> subqueryProjection)
        {
            SetLe(subqueryProjection.ToObjectSubqueryProjection());
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetLeAll(GenericSubqueryProjection<object> subqueryProjection)
        {
            SetLeAll(subqueryProjection.ToObjectSubqueryProjection());
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetLeSome(GenericSubqueryProjection<object> subqueryProjection)
        {
            SetLeSome(subqueryProjection.ToObjectSubqueryProjection());
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetLt(GenericSubqueryProjection<object> subqueryProjection)
        {
            SetLt(subqueryProjection.ToObjectSubqueryProjection());
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetLtAll(GenericSubqueryProjection<object> subqueryProjection)
        {
            SetLtAll(subqueryProjection.ToObjectSubqueryProjection());
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetLtSome(GenericSubqueryProjection<object> subqueryProjection)
        {
            SetLtSome(subqueryProjection.ToObjectSubqueryProjection());
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetNe(GenericSubqueryProjection<object> subqueryProjection)
        {
            SetNe(subqueryProjection.ToObjectSubqueryProjection());
        }

        /// <summary>
        /// <see>ICriterionProperty</see> interface summary
        /// </summary>
        public void SetNotIn(GenericSubqueryProjection<object> subqueryProjection)
        {
            SetNotIn(subqueryProjection.ToObjectSubqueryProjection());
        }

        /// <summary>
        /// Constructor, sets PropertyName
        /// </summary>
        /// <param name="propertyName">PropertyName to set</param>
        public CriterionPropertyInternal(string propertyName) : base(propertyName)
        {
        }
    }
}
